package com.example.skycode6.dao;

import com.example.skycode6.util.DBConnection;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class AdminDao {
//    DBConnection DBCoon = new DBConnection();
        DBConnection DBCoon= new DBConnection();
    public boolean Checklogin(String s1,String s2) throws SQLException {
        // conn对象代表数据路连接
        Connection conn = DBCoon.getConn();
        Statement stmt = conn.createStatement();
        ResultSet rs = null;
        boolean OK = true;
        String sql = "select * from Admin where"+"AdminName='"+s1+"and"+"AdminPwd='"+s2+"'";
        rs=stmt.executeQuery(sql);
        if(!rs.next()){
            OK = false;
        }
        return OK;
    }
}
